package Exercises;

import java.util.Scanner;

public class Task22 {

	public static void main(String[] args) {

		Scanner sc = new Scanner (System.in);
			System.out.println("Please enter a number: ");
		long first = sc.nextLong();
			System.out.println(" Please add a number for comare: ");
		long second = sc.nextLong();
		long del = 0;
		
		for (int i =10; i <= second; i *=10){
			del = i*10;
		}
		
		while(true)
		{
			if(first%del==second)
			{
				System.out.println("Yes");break;
			}
			
			first /=10;
			if (first <=0 )
			{
				System.out.println("No");break;

			}
			
		}
		
	}

}
